home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Imaging / RealShapes / RealShpe.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  4.7 KB  |  171 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        RealShpe.h
  3.  
  4.     Contains:    RealShape class, private to ODShape.
  5.  
  6.     Owned by:    Jens Alfke
  7.  
  8.     Copyright:    1993-94 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <7>     5/25/95    jpa        Use new GX headers [1241078, 1253324]
  13.          <6>     2/24/95    jpa        Removed local ODNewRgn. [1220810]
  14.          <5>     12/5/94    jpa        Code review cleanup [1203923]
  15.          <4>    10/24/94    jpa        Added ODNewRgn. [1151710]
  16.          <3>      8/8/94    jpa        Added Outset method [1178690]
  17.          <2>      8/2/94    jpa        Added AsPolygonShape.
  18.          <1>     6/15/94    jpa        first checked in
  19.                             --------Moved to SOM project and rearranged-----
  20.          <7>      5/9/94    jpa        Enable polygon clipper and GX support
  21.                                     [1162090]
  22.          <6>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  23.                                     #1150864.
  24.          <5>     2/17/94    JA        Declare XMPPolygon as struct, not class.
  25.          <4>     2/16/94    JA        Include new AltPoint.h.
  26.          <3>     2/10/94    JA        Stop using ptrs to member fns.
  27.          <2>      2/9/94    JA        Renamed from ShapePrv.h --> ShapePvM.h
  28.          <6>      2/7/94    JA        Further tigerings.
  29.          <5>      2/3/94    JA        Tiger Team Makeover!
  30.          <4>     1/31/94    JA        XMPRealShape no longer derives from
  31.                                     XMPAbsShape. Other API improvements.
  32.          <3>    11/24/93    VL        Rolled back changes as ASLM build breaks
  33.                                     the THINK build.
  34.          <2>    11/23/93    VL        Made this work with ASLM.
  35.          <1>    11/23/93    JA        first checked in
  36.          
  37.     In Progress:
  38.         
  39. */
  40.  
  41.  
  42. #ifndef _REALSHPE_
  43. #define _REALSHPE_
  44.  
  45. #ifndef _ODTYPES_
  46. #include "ODTypes.h"
  47. #endif
  48.  
  49. #ifndef _PLFMDEF_
  50. #include "PlfmDef.h"
  51. #endif
  52.  
  53. #ifndef __GXTYPES__
  54. #include <GXTypes.h>                /* for gxShape type */
  55. #endif
  56.  
  57. #ifndef _POLYCLIP_
  58. #include "PolyClip.h"            /* for ODShapeOp enum*/
  59. #endif
  60.  
  61. #ifndef __QUICKDRAW__
  62. #include <QuickDraw.h>            /* for Region type*/
  63. #endif
  64.  
  65.  
  66. //==============================================================================
  67. // Classes used in this interface
  68. //==============================================================================
  69.  
  70. class ODShape;
  71.  
  72. class PolygonShape;
  73.  
  74. //==============================================================================
  75. // QuickDraw Classic/GX Utilities
  76. //==============================================================================
  77.  
  78. void ClearGXError( );
  79. void ThrowIfGXError( );
  80. void ThrowIfFirstGXError( );
  81.  
  82. //==============================================================================
  83. // RealShape
  84. //==============================================================================
  85.  
  86. class RealShape {
  87.     public:
  88.     
  89.     RealShape( ODGeometryMode );
  90.     virtual ~RealShape( );
  91.  
  92.     ODVMethod ODSize         Purge(ODSize size);
  93.     
  94.     ODMethod void            SetGeometryMode( ODGeometryMode );
  95.     ODMethod ODGeometryMode    GetGeometryMode( );
  96.  
  97.     ODVMethod RealShape*    SetPolygon( const ODPolygon& );
  98.     ODVMethod void            Simplify( );        // Implemented only by PolygonShape
  99.  
  100.     ODMethod ODPlatformShape GetPlatformShape( ODGraphicsSystem );
  101.     ODVMethod void             SetPlatformShape( ODGraphicsSystem, ODPlatformShape );
  102.     
  103.     inline RgnHandle        GetQDRegion( )
  104.                         {return (RgnHandle)this->GetPlatformShape(kODQuickDraw);}
  105.     
  106.     ODVMethod ODBoolean        HasGeometry( );
  107.     
  108.     ODVMethod RealShape*    Clear( );
  109.     
  110.     static RealShape*        NewGeometricShape( ODGeometryMode mode );
  111.     
  112.     // Abstract stubs (these basically follow the ODShape interface:)
  113.     
  114.     ODVMethod void             GetBoundingBox( ODRect *bounds )
  115.         = 0;
  116.     ODVMethod RealShape*     SetRectangle( const ODRect *rect )
  117.         = 0;
  118.     ODVMethod void             CopyPolygon( ODPolygon& )
  119.         = 0;
  120.     ODVMethod ODBoolean        IsSameAs( RealShape* compareShape)
  121.         = 0;
  122.     ODVMethod ODBoolean        IsEmpty( )
  123.         = 0;
  124.     ODVMethod ODBoolean        ContainsPoint( ODPoint point )
  125.         = 0;
  126.     ODVMethod ODBoolean        IsRectangular( )
  127.         = 0;
  128.     ODVMethod RealShape*    Copy( )
  129.         = 0;
  130.     ODVMethod RealShape*    Transform(Environment*, ODTransform* transform)
  131.         = 0;
  132.     ODVMethod RealShape*    Outset(ODCoordinate distance)
  133.         = 0;
  134.     ODVMethod RealShape*    Subtract( RealShape* diffShape )
  135.         = 0;
  136.     ODVMethod RealShape*    Intersect(RealShape* sectShape)
  137.         = 0;
  138.     ODVMethod RealShape*    Union( RealShape* unionShape )
  139.         = 0;
  140.     
  141.     ODVMethod RealShape*    Combine( ODShapeOp, RealShape* );
  142.  
  143. #if ODDebug
  144.     char                    GetType( ) const        {return fType;}
  145. #endif
  146.  
  147.     protected:
  148.     
  149.     ODVMethod RealShape*    ReplaceWith( RealShape* ); // Delete me & return copy of shape
  150.     ODVMethod RealShape*    AsPolygonShape( );            // Return equivalent polygon/GX shape
  151.     ODMethod RealShape*        Promote( ODShapeOp =kShapeNoOp,
  152.                                      RealShape*  =NULL);    // Convert & perform op
  153.     
  154.     ODVMethod gxShape        CopyGXShape( )            // Return a GX shape
  155.                                 = 0;    
  156.     ODVMethod void            InitQDRegion( )            // Called when fQDRegion needs to be set
  157.                                 = 0;
  158.     
  159. #if ODDebug
  160.     char                    fType;                    // Number identifying class type:
  161. #endif                                                /* 0=Rect, 1=Rgn, 2=Poly, 3=GX*/
  162.  
  163.     ODGeometryMode            fMode;                    // Geometry mode
  164.     RgnHandle                fQDRegion;                // Cached QuickDraw region
  165. };
  166.  
  167.  
  168. extern ODBoolean gGX;        // Is GX installed?
  169.  
  170.  
  171. #endif /*_REALSHPE_*/